// JavaScript Document
var setting = {
	data: {
		simpleData: {
			enable: true
		}
	},
	callback: {
			onClick: onClick
		}
};
var zNodes =[
	{ id:1, pId:0, name:"身份树",title:"", open:true, iconSkin:"sf1",levels:"a0"},
		{ id:11, pId:1, name:"食堂人员",title:"", open:true, iconSkin:"sf1", levels:"a1" },
			{ id:111, pId:11, name:"后厨人员",title:"",open:true, iconSkin:"sf2", levels:"a2"},		
];

function onClick(event, treeId, treeNode, clickFlag) {
	
	var Level=treeNode.levels;
	var	zTree = $.fn.zTree.getZTreeObj("treeDemo");
	var sid = $("#treeDemo").attr("selctId");  //前一次选中的节点Id
	var tid = treeNode.tId;					   //当前选中的节点ID	
	
	
	zTree.updateNode(treeNode);
	$("#treeDemo").attr("selctId", treeNode.tId);
}

$(document).ready(function(){
	$.fn.zTree.init($("#treeDemo"), setting, zNodes);
	$("#hideNodesBtn").bind("click", {type:"rename"}, hideNodes);
	$("#showNodesBtn").bind("click", {type:"icon"}, showNodes);
});	